package com.ng.finance.api.entity;

import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableLogic;
import com.baomidou.mybatisplus.enums.FieldFill;
import com.baomidou.mybatisplus.enums.IdType;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang.StringUtils;

import java.io.Serializable;
import java.util.Date;

/**
 * <p>
 *
 * </p>
 *
 * @author 83673
 * @since 2018-11-05
 */
public class BxVoucher extends Model<com.ng.finance.api.entity.BxVoucher> {

    public static final String ID = "id";
    public static final String BX_MONEY = "bx_money";
    public static final String BX_NAME = "bx_name";
    public static final String BX_TIME = "bx_time";
    public static final String BX_PIC = "bx_pic";
    public static final String CREATE_TIME = "create_time";
    public static final String DEL_FLAG = "del_flag";
    public static final String BX_TAG = "bx_tag";
    public static final String USER_ID = "user_id";
    public static final String BX_ID = "bx_id";
    private static final long serialVersionUID = 1L;
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;
    /**
     * 报销金额
     */
    private Double bxMoney;
    /**
     * 报销人
     */

    private String bxName;
    /**
     * 报销时间
     */
    private String bxTime;
    /**
     * 报销凭证
     */
    private String bxPic;
    @TableField(fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createTime;
    @TableLogic
    private Integer delFlag;
    /**
     * 是否报销  1--已报销  2--未报销
     */
    private Integer bxTag;
    /**
     * 报销人id
     */
    private Long userId;
    private String bxId;//被报销的id
    @TableField(exist = false)
    private String[] payPicArry;

    public BxVoucher(Long id) {
        this.id = id;
    }

    public BxVoucher() {

    }

    public BxVoucher(Double bxMoney, Long userId, String userName, String time, String bxId) {

        this.bxMoney = bxMoney;
        this.bxName = userName;
        this.bxTime = time;
        this.userId = userId;
        this.bxId = bxId;
    }

    public static String getID() {
        return ID;
    }

    public String[] getPayPicArry() {
        if (StringUtils.isNotBlank(bxPic)) {
            return bxPic.split(";");
        }

        return new String[]{};
    }

    public void setPayPicArry(String[] payPicArry) {
        this.payPicArry = payPicArry;
    }

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public String getBxId() {
        return bxId;
    }

    public void setBxId(String bxId) {
        this.bxId = bxId;
    }

    public String getBxTime() {
        return bxTime;
    }

    public void setBxTime(String bxTime) {
        this.bxTime = bxTime;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Double getBxMoney() {
        return bxMoney;
    }

    public void setBxMoney(Double bxMoney) {
        this.bxMoney = bxMoney;
    }

    public String getBxName() {
        return bxName;
    }

    public void setBxName(String bxName) {
        this.bxName = bxName;
    }

    public String getBxPic() {
        return bxPic;
    }

    public void setBxPic(String bxPic) {
        this.bxPic = bxPic;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Integer getDelFlag() {
        return delFlag;
    }

    public void setDelFlag(Integer delFlag) {
        this.delFlag = delFlag;
    }

    public Integer getBxTag() {
        return bxTag;
    }

    public void setBxTag(Integer bxTag) {
        this.bxTag = bxTag;
    }

    @Override
    protected Serializable pkVal() {
        return this.id;
    }

    @Override
    public String toString() {
        return "BxVoucher{" +
                "id=" + id +
                ", bxMoney=" + bxMoney +
                ", bxName=" + bxName +
                ", bxTime=" + bxTime +
                ", bxPic=" + bxPic +
                ", createTime=" + createTime +
                ", delFlag=" + delFlag +
                ", bxTag=" + bxTag +
                ", userId=" + userId +
                ", bxId=" + bxId +
                "}";
    }
}
